import java.awt.geom.Point2D;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;


public class GraveyardMain {

	private ArrayList<Graveyard> graveYards = new ArrayList<Graveyard>();
	private final String FILENAME = "graveyard_input.txt";
	
	public static void main(String[] args) throws Exception 
	{
		GraveyardMain main = new GraveyardMain();
		main.readInput();
		main.runBellmanFord();
	}
	
	private void readInput() throws IOException
	{
		// Read data to a StringBuilder 
		ArrayList<String> textFile = new ArrayList<String>();
	    Scanner scanner = new Scanner(new FileInputStream(FILENAME), "UTF8");
	    try 
	    {
		    while (scanner.hasNextLine())
		    {
		    	textFile.add(scanner.nextLine());
		    }
	    }
	    finally
	    {
	    	scanner.close();
	    }
		
		// Edit data
	    int currentLine = 0;
		while (currentLine < textFile.size() - 1)
		{
			// Create new graveyard
			String[] firstLine = textFile.get(currentLine).split(" ");
			int countGraveStones = Integer.parseInt(textFile.get(currentLine + 1).trim());
			currentLine += 2;
			
			ArrayList<Point2D> graveStones = new ArrayList<Point2D>();
			for (int i = 0; i < countGraveStones; i++)
			{
				String[] line = textFile.get(currentLine).split(" ");				
				graveStones.add(new Point2D.Double(Integer.parseInt(line[0].trim()), Integer.parseInt(line[1].trim())));
				currentLine++;
			}
						
			int countHauntedHoles = Integer.parseInt(textFile.get(currentLine).trim());
			currentLine++;
			ArrayList<HauntedHole> hauntedHoles = new ArrayList<HauntedHole>();
			for (int i = 0; i < countHauntedHoles; i++)
			{
				String[] line = textFile.get(currentLine).split(" ");			
				
				// Origin and destination of an haunted hole can be identical
				if (line[0].trim() == line[2].trim() && line[1].trim() == line[3].trim())
					continue;
				
				hauntedHoles.add(new HauntedHole(new Point2D.Double(Integer.parseInt(line[0].trim()), Integer.parseInt(line[1].trim()))
						, new Point2D.Double(Integer.parseInt(line[2].trim()), Integer.parseInt(line[3].trim()))
						, Integer.parseInt(line[4].trim())));
				currentLine++;
			}
			
			this.graveYards.add(new Graveyard
					(Integer.parseInt(firstLine[0].trim()), Integer.parseInt(firstLine[1].trim()),graveStones, hauntedHoles));
		}
	}
	
	private void runBellmanFord()
	{
		// Run BellmanFord for all graveyards
		for (int i = 0; i < this.graveYards.size(); i++) 
		{
			Graveyard currentGraveyard = this.graveYards.get(i);
			
			Point2D origin = currentGraveyard.origin;
			Point2D destination = currentGraveyard.destination;
			
			long[][] timeDistance = new long[currentGraveyard.nodes.length][currentGraveyard.nodes[0].length];
			int[][] pre = new int[currentGraveyard.nodes.length][currentGraveyard.nodes[0].length];
			
			// Initialize
			// Iterate over width.
			for (int j = 0; j < currentGraveyard.nodes.length; j++) 
			{	
				// Iterate over height.
				for (int k = 0; k < currentGraveyard.nodes[j].length; k++) 
				{
					timeDistance[j][k] = Integer.MAX_VALUE;
					pre[j][k] = -1;
				}
			}
			// Set startNode
			timeDistance[(int) origin.getX()][(int) origin.getY()] = 0;		
			
			for (int l = 1; l < currentGraveyard.nodes.length * currentGraveyard.nodes[0].length; l++)
			{
				for (Edge edge: currentGraveyard.edges)
				{
					// Relax Edge
					if (timeDistance[(int) edge.destination.getX()][(int) edge.destination.getY()] 
							>  timeDistance[(int) edge.origin.getX()][(int) edge.origin.getY()] + edge.time )
					{  
						timeDistance[(int) edge.destination.getX()][(int) edge.destination.getY()] 
								= timeDistance[(int) edge.origin.getX()][(int) edge.origin.getY()] + edge.time; 
					}
				}
			}
			
			if (timeDistance[(int) destination.getX()][(int) destination.getY()] == Integer.MAX_VALUE)
			{
				System.out.println("IMPOSSIBLE");
				continue;
			}
			
			boolean isNegativeZykle = false;
			for ( Edge edge: currentGraveyard.edges )
			{
				if (timeDistance[(int) edge.destination.getX()][(int) edge.destination.getY()] 
						> timeDistance[(int) edge.origin.getX()][(int) edge.origin.getY()] + edge.time )
				{  
					System.out.println("NEVER"); 
					isNegativeZykle = true;
					break;
				}
			}
			if (isNegativeZykle) continue;
			
			System.out.println("BEST TIME: "+ timeDistance[(int) destination.getX()][(int) destination.getY()]);
		}
	}

}

class Graveyard
{
	public int[][] nodes;
	public ArrayList<Point2D> graveStones;
	public ArrayList<HauntedHole> hauntedHoles;
	public ArrayList<Edge> edges;
	public Point2D origin;
	public Point2D destination;
	
	public Graveyard(int w, int h, ArrayList<Point2D> graveStones, ArrayList<HauntedHole> hauntedHoles)
	{
		nodes = new int[w][h];
		this.graveStones = graveStones;
		this.hauntedHoles = hauntedHoles;
		this.edges = new ArrayList<Edge>();
		this.origin = new Point2D.Double(0,0);
		this.destination = new Point2D.Double(w - 1,h - 1);
		initialize();
	}
	
	private void initialize()
	{
		// Iterate over width.
		for (int i = 0; i < nodes.length; i++) 
		{	
			// Iterate over height.
			for (int j = 0; j < nodes[i].length; j++) 
			{
				if (this.graveStones.contains(new Point2D.Double(i,j)))
					continue;
				if (this.hauntedHoles.contains(new HauntedHole(new Point2D.Double(i,j),null, 0)))
				{
					HauntedHole currentHole = this.hauntedHoles.get(this.hauntedHoles
							.indexOf(new HauntedHole(new Point2D.Double(i,j),null, 0)));
					
					this.edges.add(new Edge(currentHole.origin, currentHole.destination, currentHole.time));
				}
				else 
				{
					// Look in all directions
					if (i - 1 >= 0 && !this.graveStones.contains(new Point2D.Double(i - 1,j))) // Left
						this.edges.add(new Edge(new Point2D.Double(i,j),new Point2D.Double(i - 1,j), 1));
					if (i + 1 < nodes.length && !this.graveStones.contains(new Point2D.Double(i + 1,j))) // Right
						this.edges.add(new Edge(new Point2D.Double(i,j),new Point2D.Double(i + 1,j), 1));
					if (j - 1 >= 0 && !this.graveStones.contains(new Point2D.Double(i,j - 1))) // Up
						this.edges.add(new Edge(new Point2D.Double(i,j),new Point2D.Double(i,j - 1), 1));
					if (j + 1 < nodes[i].length && !this.graveStones.contains(new Point2D.Double(i,j + 1))) // Down
						this.edges.add(new Edge(new Point2D.Double(i,j),new Point2D.Double(i,j + 1), 1));
				}
			}
		}
	}
}

class HauntedHole
{
	public Point2D origin;
	public Point2D destination;
	public int time;
	
	public HauntedHole(Point2D origin, Point2D destination, int time)
	{
		this.origin = origin;
		this.destination = destination;
		this.time = time;
	}
	
	@Override
	public boolean equals(Object obj)
	{
		HauntedHole holeOther;
		if (obj instanceof HauntedHole)
			holeOther = (HauntedHole) obj;
		else 
			return false;
		
		
		if (holeOther.origin.getX() == this.origin.getX() && holeOther.origin.getY() == this.origin.getY())
			return true;
		else
			return false;
		
	}
}

class Edge
{
	public Point2D origin;
	public Point2D destination;
	public int time;
	
	public Edge(Point2D origin, Point2D destination, int time)
	{
		this.origin = origin;
		this.destination = destination;
		this.time = time;
	}
}